package com.t235.gc.biz.service.impl;

import com.t235.gc.entity.Bankcar;
import com.t235.gc.dao.BankcarDao;
import com.t235.gc.biz.service.BankcarService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 银行卡表(Bankcar)表服务实现类
 *
 * @author makejava
 * @since 2021-03-24 08:45:16
 */
@Service("bankcarService")
public class BankcarServiceImpl implements BankcarService {
    @Resource
    private BankcarDao bankcarDao;

    /**
     * 通过ID查询单条数据
     *
     * @param bankid 主键
     * @return 实例对象
     */
    @Override
    public Bankcar queryById(Long bankid) {
        return this.bankcarDao.queryById(bankid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<Bankcar> queryAllByLimit(int offset, int limit) {
        return this.bankcarDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param bankcar 实例对象
     * @return 实例对象
     */
    @Override
    public Bankcar insert(Bankcar bankcar) {
        this.bankcarDao.insert(bankcar);
        return bankcar;
    }

    /**
     * 修改数据
     *
     * @param bankcar 实例对象
     * @return 实例对象
     */
    @Override
    public Bankcar update(Bankcar bankcar) {
        this.bankcarDao.update(bankcar);
        return this.queryById(bankcar.getBankid());
    }

    /**
     * 通过主键删除数据
     *
     * @param bankid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long bankid) {
        return this.bankcarDao.deleteById(bankid) > 0;
    }
}
